package net.huashitong.ssydt.provider.exam.service;


import net.huashitong.ssydt.exam.entity.SsExamErrorRecord;
import net.huashitong.ssydt.provider.exam.mapper.SsExamErrorRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author <a href="mailto:yhy23456@163.com">huiyang.yu</a>
 * @since 2017.09.06
 */
@Service
@Transactional
public class SsExamErrorRecordServiceImpl implements SsExamErrorRecordService {

    private SsExamErrorRecordMapper mapper;

    @Autowired
    public SsExamErrorRecordServiceImpl(SsExamErrorRecordMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SsExamErrorRecord record) {
        return mapper.insert(record);
    }

    @Override
    public int insertSelective(SsExamErrorRecord record) {
        return mapper.insertSelective(record);
    }

    @Override
    public SsExamErrorRecord selectByPrimaryKey(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(SsExamErrorRecord record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SsExamErrorRecord record) {
        return mapper.updateByPrimaryKey(record);
    }

    @Override
    public SsExamErrorRecord getByUserIdWithBelongYearMonth(String userId, String belongYearMonth) {
        SsExamErrorRecord record = new SsExamErrorRecord();
        record.setUserId(userId);
        record.setBelongYearMonth(belongYearMonth);
        return mapper.getByUserIdWithBelongYearMonth(record);
    }

    @Override
    public List<SsExamErrorRecord> findBelongYearMonthDescByUserId(String userId) {
        return mapper.findBelongYearMonthDescByUserId(userId);
    }

    @Override
    public int deleteByUserIdWithBelongYearMonth(String userId, String belongYearMonth) {
        SsExamErrorRecord record = new SsExamErrorRecord();
        record.setUserId(userId);
        record.setBelongYearMonth(belongYearMonth);
        return mapper.deleteByUserIdWithBelongYearMonth(record);
    }

    @Override
    public int deleteByUserId(String userId) {
        return mapper.deleteByUserId(userId);
    }
}
